﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;
using Pigmalion.BusinessEntities;
using Pigmalion.DataAccess;

namespace Pigmalion.BusinessLogic
{
    public partial class ClienteBL:IClienteBL
    {
        IClienteRepository ClienteRepository;

        public ClienteBL()
        {
            using (IUnityContainer container = new UnityContainer())
            {
                container.LoadConfiguration();

                ClienteRepository = container.Resolve<IClienteRepository>();
            }
        }

        public List<Cliente> GetAllFromCliente()
        {
            return ClienteRepository.GetAllFromCliente();
        }

        public List<Cliente> GetFromClienteByRazonSocial(string criterio)
        {
            return ClienteRepository.GetFromClienteByRazonSocial(criterio);
        }

        public List<Cliente> GetFromClienteByRucDni(string criterio)
        {
            return ClienteRepository.GetFromClienteByRucDni(criterio);
        }

        Cliente IClienteBL.GetOneFromClienteByRucDni(string criterio)
        {
            return ClienteRepository.GetOneFromClienteByRucDni(criterio);
        }

        public Cliente GetFromClienteById(int id)
        {
            return ClienteRepository.GetFromClienteById(id);
        }
    }
}
